<template>
  <div>
    <div @click="toSoleSong"><Title title="独家放送"></Title></div>
    <div class="solecontent">
      <div
        class="solesong"
        v-for="item in personalsong"
        :key="item.id"
        :data-id="item.id"
        @click="personalSong"
      >
        <img class="soleimg" v-lazy="item.picUrl" />
        <div class="sole-bofang">
          <span class="iconfont icon-bofang"></span>
        </div>
        <div class="soleword">{{ item.name }}</div>
      </div>
    </div>
  </div>
</template>

<script>
import Title from '../PersonalRecommend/components/Title/title.vue'
export default {
  name: 'soleSong',
  data() {
    return {
      personalsong: [],
    }
  },
  components: {
    Title,
  },
  methods: {
    async reqpersonalized() {
      const res = await this.$API.RecommentSong.reqpersonalizedList()
      this.personalsong = res.result
      console.log(res.result)
    },
    // 点击标题实现跳转
    toSoleSong() {
      this.$router.history.push({ path: '/dujiasong' })
    },
    //点击mv图片,带上id跳转
    personalSong() {
      // 拿到独家放送id
      const { id } = event.currentTarget.dataset
      // console.log(id);
      // 跳转页面，并将数据传过去
      this.$router.history.push({
        name: 'DuJiaSong',
        query: {
          id,
        },
      })
    },
  },
  mounted() {
    this.reqpersonalized()
  },
}
</script>

<style scoped>
.solesong {
  position: relative;
  flex-grow: 0;
  width: 32%;
  min-width: 32%;
}
.sole-bofang {
  position: absolute;
  margin-top: -160px;
  margin-left: 8px;
}
.solecontent {
  margin-left: 20px;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
.soleimg {
  /* width: 380px; */
  height: 160px;
  width: 100%;
  border-radius: 5px;
  z-index: -1;
}
.soleword {
  width: 330px;
  line-height: 28px;
  color: rgb(82, 79, 79);
  white-space: wrap;
}
/* 图标 */
.icon-bofang {
  font-size: 30px;
  color: rgb(248, 134, 99);
  position: absolute;
}
</style>